﻿using DevExpress.LookAndFeel;
using DevExpress.Skins;
using DevExpress.UserSkins;
using System;
using System.Configuration;
using System.Threading;
using System.Windows.Forms;

namespace EkStudio
{
    static class Program
    {

        private static string skin = "Visual Studio 2013 Light";
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(String[] args)
        {
            bool createNew;

            using (Mutex mutex = new Mutex(true, Application.ProductName, out createNew))
            {
                if (createNew)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    BonusSkins.Register();
                    SkinManager.EnableFormSkins();
                    LoadInit();
                    Application.Run(new FormMain());
                }
                else
                {
                    // 程序已经运行,显示提示后退出
                    MessageBox.Show("程序已启动");
                    Application.Exit();//退出程序   
                }
            }
        }

        private static void LoadInit()
        {
            skin = ConfigurationManager.AppSettings["SetSkinStyle"];
            UserLookAndFeel.Default.SetSkinStyle(skin);
        }
    }
}
